package com.zyf.hos.gw.util;

import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
@Data
public class CountUtil {
    private String name = "123";
    private Date beginTime = new Date();
    private boolean flag = false;
    final int num = 0;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name+(+num);
    }

    /**
     * 第一次访问生成name-01
     *  需要判断是否失效
     *      2分钟后失效，重新生成name-02
     */



    public boolean isFlag(Date current) {
        return current.getTime()>(this.getBeginTime().getTime()+5000);
    }
}
